{% extends "openvolunteer/base.html" %}

{% block title %}OpenVolunteer | Accueil{% endblock %}

{% block content %}
    <div class="OV_index_line">
        {% for job in jobs %}
            <div class="OV_index_box">
                <a name="{{ job.stripped_title }}" />
                <div class="OV_index_box_title">
                    <a href="#{{ job.stripped_title }}" 
                       onClick="displayBoxContent('{{ job.stripped_title }}');" 
                       title="Ouvrir cette boite d'information">{{ job.title }}</a>
                </div>
                <div id="{{ job.stripped_title }}" class="OV_index_box_content">
                    <p>{{ job.description }}</p>
                    {% if job.boss.all %}
                        <p><b>Responsables:</b></p>
                        <ul>
                            {% for b in job.boss.all %}
                                <li><a href="{{ b.get_absolute_url }}" title="Consulter la fiche de ce bénévole">{{ b }}</a></li>
                            {% endfor %}
                        </ul>
                    {% else %}
                        <p><b>Pas de responsable pour le moment...</b></p>
                    {% endif %}
                </div>
            </div>
        {% endfor %}
    </div>
        <script type="text/javascript">
            function displayBoxContent(id){
                box = document.getElementById(id);
                if (box.style.visibility == 'hidden'){
                    box.style.visibility = 'visible';
                } else {
                    box.style.visibility = 'hidden';
                }
            }
            {% if selected_job %}
                {% for job in jobs %}
                    document.getElementById('{{ job.stripped_title }}').style.visibility = 'hidden';
                {% endfor %}
                displayBoxContent('{{ selected_job.stripped_title }}');
            {% endif %}
        </script>
{% endblock %}


{% block navigation %}
    <ul>
        <li><a href="/admin/openvolunteer/job/add" title="">Ajouter un poste</a></li>
        <li><a href="/openvolunteer/volunteer/" title="">Chercher un bénévole</a></li>
        <li><a href="/openvolunteer/event/" title="">Chercher un événement</a></li>
        <li><a href="/openvolunteer/answer/" title="">Chercher une réponse de participation</a></li>
    </ul>
{% endblock %}
